<?php

namespace app\stores\controller\product;

use think\Controller;


class Type extends Controller{
    public function __construct()
    {
        parent::__construct();

        $this->ProductModel=model('Product.Product');
        $this->TypeModel=model('Product.Type');
    }

    public function index(){
        if($this->request->isPost()){
            $type=$this->TypeModel->select();

            foreach($type as $item){
                $item['typepros']=$this->ProductModel->where(['typeid'=>$item['id']])->limit(4)->select();
            }

            $this->success('返回分类列表数据成功',null,$type);
            exit;
        }
    }
}